package cn.gs.timer.server;

import cn.gs.common.CommonMain;
import java.rmi.RemoteException;
import java.util.logging.Level;
import java.util.logging.Logger;

/*
 * @author gs
 */
public class Main {

    public static final String SERVER_NAME = "TimerServer";
    public static CommonMain common;
    public static TimerServer timerServer;
    public static TimerThread timerThread;

    public static void main(String[] args) {
        common = new CommonMain();
        boolean commonFlag = common.init(SERVER_NAME);
        if (!commonFlag) {
            System.exit(1);
        }
        timerThread = new TimerThread();
        commonFlag &= timerThread.init();
        if (!commonFlag) {
            System.exit(2);
        }
        try {
            timerServer = new TimerServer();
        } catch (RemoteException ex) {
            Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
            System.exit(3);
        }
        commonFlag &= timerServer.init(SERVER_NAME);
        if (!commonFlag) {
            System.exit(3);
        }
    }
}
